package com.eolcum.evo.evocenter.thread;

import java.util.Calendar;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import com.eolcum.evocenter.Action;
import com.eolcum.evocenter.ActionBuffer;

@EnableScheduling
public class LogManager {

	@Autowired private ActionBuffer buffer;
	
    @Scheduled(cron="0 0 02 * * ?")
    public void demoServiceMethod()
    {
		Action a = new Action();
		a.setActionType(Action.ACTION_TYPE_SINGLE);
		a.setTimeStamp(Calendar.getInstance().getTimeInMillis());
		a.setAction(Action.ACTION_GET_YESTERDAY_SENSOR_LOG);
		a.setResponseURL("http://192.168.1.57:9091/logService/setSensorLog");
		List<Action> actionList = buffer.getActionList("1"); //TODO should be added for each evo
		actionList.add(a);
    }
}
